package com.aspose.cells;

public class zal {
   private zcfx b;
   private StringBuilder c;

   public zal(com.aspose.cells.b.a.d.zm var1, Encoding var2, boolean var3) throws Exception {
      if (var2.i() == 65000) {
         assert "utf-7".equals(var2.a());

         byte[] var4 = var2.g();
         if (var4.length == 0) {
            var4 = com.aspose.cells.a.d.zai.a();
            var1.b(var4, 0, var4.length);
         }
      }

      this.b = zasr.a(var1, var2);
      this.c = new StringBuilder(2048);
      this.b.d(false);
      if (var3) {
         this.b.a((int)1);
         this.b.b(1);
         this.b.a('\t');
      }

   }

   public zal(com.aspose.cells.b.a.d.zm var1, boolean var2) throws Exception {
      this(var1, Encoding.getUTF8(), var2);
   }

   public zcfx a() {
      return this.b;
   }

   public void a(String var1) throws Exception {
      this.b.b(true);
      this.b(var1);
   }

   public void b() throws Exception {
      this.b.b();
      this.b.d();
      this.b.e();
   }

   public void b(String var1) throws Exception {
      this.b.b(var1);
   }

   public void c() throws Exception {
      this.b.b();
   }

   public void a(String var1, String var2) throws Exception {
      this.b(var1);
      this.c(var2);
      this.c();
   }

   public void b(String var1, String var2) throws Exception {
      if (com.aspose.cells.a.d.zcq.a(var2)) {
         this.a(var1, var2);
      }

   }

   public void a(String var1, DateTime var2) throws Exception {
      if (var2.getYear() > 1) {
         this.a(var1, com.aspose.cells.a.c.zp.a(var2));
      }

   }

   public void c(String var1) throws Exception {
      this.b.a(this.d(var1));
   }

   public void c(String var1, String var2) throws Exception {
      this.b.a(var1, this.d(var2));
   }

   public String d(String var1) {
      if (!e(var1)) {
         return var1;
      } else {
         this.c.setLength(0);

         for(int var2 = 0; var2 < var1.length(); ++var2) {
            char var3 = var1.charAt(var2);
            if (a(var3)) {
               this.c.append(var3);
            }
         }

         return com.aspose.cells.b.a.zr.a(this.c);
      }
   }

   private static boolean e(String var0) {
      if (!com.aspose.cells.a.d.zcq.a(var0)) {
         return false;
      } else {
         for(int var1 = 0; var1 < var0.length(); ++var1) {
            if (!a(var0.charAt(var1))) {
               return true;
            }
         }

         return false;
      }
   }

   private static boolean a(char var0) {
      return var0 == '\t' || var0 == '\n' || var0 == '\r' || var0 >= ' ' && var0 <= '\ud7ff' || var0 >= '\ue000' && var0 <= '�';
   }
}
